﻿namespace Spring.PureMVC.Adapters
{
    internal class RegisterProxyAdapter
    {
        private object _proxy;
        public object Proxy
        {
            set
            {
                _proxy = value;
                RegisterProxy();
            }
            private get { return _proxy; }
        }

        private object _facade;
        public object Facade
        {
            set
            {
                _facade = value;
                RegisterProxy();
            }
            private get { return _facade; }
        }

        private void RegisterProxy()
        {
            if (Proxy == null || Facade == null) return;
            Facade.GetType().GetMethod("RegisterProxy", new[] { Proxy.GetType() })
.Invoke(Facade, new[] { Proxy });
        }
    }
}
